package common

import "time"

type Gender int

const (
	//
	Female Gender = 0
	Male   Gender = 1
	Third  Gender = 2
)

type TimeLayout string

const Date TimeLayout = "2006-01-02"
const DateTime TimeLayout = "2009-01-02 15:03:38"
const DataTimeZone TimeLayout = "2006-01-02 15:04:05Z0700"

func StrToTime(str string, layout ...TimeLayout) (time.Time, error) {
	format := Date
	if len(layout) > 0 {
		format = layout[0]
	}
	return time.Parse(string(format), str)
}

func TimeToStr(t time.Time, layout ...TimeLayout) string {
	format := Date
	if len(layout) > 0 {
		format = layout[0]
	}
	return t.Format(string(format))
}
